<!Doctype html>
<html>
	<head>
		<title></title>
		<script type="text/javascript" src="../test-jq/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript">

/*var Person = {
	Create: function(name,age){
		this.name = name;
		this.age = age;
	},
	SayHello: function(){
		alert("Hello, I'm " + this.name);
	},
	HowOld: function(){
		alert(this.name + " is " + this.age + " years old.")
	}
};


function anyfunc(){}
anyfunc.prototype = Person;
var xuxuan = new anyfunc();
xuxuan.Create("kathy",25);
xuxuan.SayHello();
xuxuan.HowOld();
*/

//---------------------------------------------------------------------------------------------------------

/*//通用创建函数
function New(aClass, aParams){
	function new_(){  //定义临时的中转函数壳
		aClass.Create.apply(this, aParams);  //调用原型中定义的构造函数
	};
	new_.prototype = aClass;  //转杯中转原型对象
	return new new_();  //返回建立最终建立的对象
};

var Person = {
	Create: function(name,age){
		this.name = name;
		this.age = age;
	},
	SayHello: function(){
		alert("Hello, I'm " + this.name);
	},
	HowOld: function(){
		alert(this.name + " is " + this.age + " years old.")
	}
};

var xuxuan = New(Person,["kathy",22]);
xuxuan.SayHello();
xuxuan.HowOld();
alert(xuxuan.constructor == Object);  //true*/

//---------------------------------------------------------------------------------------------------------

/*
//定义小写的object基本类，用于实现最基础的方法
var object = {
	isA: function(aType){
		var self = this;
		while(self){
			if(self == aType)
				return true;
			self = self.Type;
		};
		return false;
	}
};

//类的创建函数，用于声明及继承关系
function Class(aBaseClass, aClassDefine){

	//创建类的临时函数壳
	function class_(){
		this.Type = aBaseClass;  //给每一个类约定一个Type属性，引用其继承的类
		for(var member in aClassDefine){
			this[member] = aClassDefine[member];  //复制类的全部定义到当前创建的类
		}
	};
	class_.prototype = aBaseClass;
	return new class_();
};

//对象的创建函数，用于任意类的对象创建
function New(aClass, aParams){

	//创建类的临时函数壳
	function new_(){
		this.Type = aClass;  //给每一个对象约定一个Type属性，据此可以访问到对象所属的类
		if(aClass.Create){
			aClass.Create.apply(this, aParams);  //约定所有类的构造函数都叫Create
		}
	};
	new_.prototype = aClass;
	return new new_();
}

var Person = Class(object,{  //派生自object基本类
	Create: function(name, age){
		this.name = name;
		this.age = age;
	},
	SayHello: function(){
		console.log("Hello I'm " + this.name + ", " + this.age + " years old.");
	}
});

var Employee = Class(Person,{  //派生自person类
	Create: function(name, age, salary){
		Person.Create.call(this, name, age);
		this.salary = salary;
	},
	ShowMeTheMoney: function(){
		console.log(this.name + " $" + this.salary);
	}
});

var xuxuan = New(Person,["xuxuan", 25]);
var cgg = New(Employee, ["cgg", 24, 88888]);
xuxuan.SayHello();
cgg.SayHello();
cgg.ShowMeTheMoney();

console.log(Person);
console.log(Employee);
console.log(xuxuan);
console.log(cgg);

var littleXu = New(xuxuan.Type,["littleXu", 6]);   //用xuxuan的类型（也就是Person）建立littleXu
var littleCgg = New(cgg.Type,["littleCgg", 6, 123]);  //用cgg的类型（也就是Employee）建立littleCgg
littleXu.SayHello();
littleCgg.SayHello();
littleCgg.ShowMeTheMoney();

console.log(xuxuan.isA(object));    //true
console.log(xuxuan.isA(Person));   	//true
console.log(xuxuan.isA(Employee));   //false
console.log(cgg.isA(Person));   	//true
console.log(cgg.isA(Employee));   	//true
console.log(Person.isA(Employee));   //false
console.log(Employee.isA(Person));   //true
*/



function Class(){
	var aDefine = arguments[arguments.length - 1]; //最后一个参数是类定义

}






		</script>
		<style type="text/css"></style>
	</head>
	<body>
		
	</body>
</html>